<template>
	<view>
		<view class="father">
			<view class="question">	
				<text>{{kw}}</text>
			</view>
		</view>
		<view class="picture">
			<img src="/static/logo1.png" alt="" />
			<text>asst</text>
		</view>
		<view class="answer">
			<text>{{result}}</text>
		</view>
		
	</view>
</template>

<script>
	export default {
		props:['kw'],
		data() {
			return {
				result:'',
			}
		},
		onLoad() {
			this.getSearchList()
		},
		methods: {
			// 列出推荐的项目
			getSearchList(){
				if(this.kw===''){
					this.result=''
					return
				}
				var _this = this
				uni.request({
					url:'http://47.97.5.12:5000//api//data',
					method:"POST",
					header:{
					"Content-Type": "application/x-www-form-urlencoded"	
					},
					data:{
						input:JSON.stringify(this.kw)
					},
					success:function(res){
						if(res.statusCode===200){
							_this.result=res.data.output
						}
					},
					fail: (err) => {
						console.log(err)
					}
				})
				this.result=_this.result
			},
		}
	}
</script>

<style>
.answer{
	background-color: #5d5cde;
	color: white;
	margin-top: 10px;
	position: relative;
	left:10px;
	max-width:300px;
	width:fit-content;
	border-radius: 0px 10px 10px 10px;
	padding: 2.5px 2.5px;
}
.question{
		position:relative;
		width:auto;
		float: right;
		right:10px;
		max-width: 225px;
		background-color: #e7efe3;
		border-radius: 10px 0px 10px 10px;
		padding: 2.5px 2.5px;
		margin-top: 20px;
	}
.picture img{
	display: block;
	margin-right:7.5px;
	margin-left: 5px;
	margin-top: 5px;
	width: 40px;
	height: 40px;
	border-radius: 15px;
}
.picture text{
	font-size: 20px;
	margin-top: 10px;
	margin-left:10px;
	position: relative;
}
.picture{
	width: 100%;
	position: relative;
	display: flex;
}
/* 根据字符串的长度改变宽度 */
/* 添加头像 */
</style>
